// -----------ArtDex-------------------------
function chooseTheme() {
	var str = document.getElementById('categoryID').value;
	var url = "/loadTheme/" + str;
	ajax_loadContent("themeDiv", url);
}

function addartist() {
	if (document.form1.artistFname.value == '') {
		alert("Name Must Be Filled ");
		document.form1.artistFname.focus();
		return false;
	}
	if (document.form1.artistAds.value == '') {
		alert("Enter Address  ");
		document.form1.artistAds.focus();
		return false;
	}
	if (document.form1.city.value == '') {
		alert("City Must Be Filled  ");
		document.form1.city.focus();
		return false;
	}
	if (document.form1.artistState.value == '') {
		alert("State Must Be Filled! ");
		document.form1.artistState.focus();
		return false;
	}
	if (document.form1.artistCountry.value == '') {
		alert("Country Must Be Filled! ");
		document.form1.artistCountry.focus();
		return false;
	}
	if (document.form1.mob.value == "" && document.form1.phone.value == "") {
		alert('Please enter mobile no! or Phone Number! ');
		document.form1.mob.focus();
		return false;
	}
	var mb = /^[0-9\s]+$/;
	if (!document.form1.mob.value.match(mb)
			&& !document.form1.phone.value.match(mb)) {
		alert("Please Enter  A Valid NUmber!");
		document.form1.mob.focus();
		return false;
	}

	if (document.form1.Email.value == '') {
		alert("Email Must Be Filled! ");
		document.form1.Email.focus();
		return false;
	}
	var em = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
	if (!document.form1.Email.value.match(em)) {
		alert("Please provide A Valid Email!");
		document.form1.Email.focus();
		return false;
	}

	if (document.getElementById('area1').value == '<p></p>') {
		alert("AboutUs cannot be empty");
		document.form1.area1.focus();
		return false;
	}

}
function chooseGTheme() {
	var str = document.getElementById('categoryID').value;
	var url = "/loadGTheme/" + str;
	ajax_loadContent("themeDiv", url);
}

function chooseGmedium() {
	var str = document.getElementById('themeID').value;
	var url = "/loadGmedium/" + str;
	ajax_loadContent("mediumDiv", url);
}
function addgallery() {
	if (document.getElementById('artistID').value == '') {
		alert("Please Select Artist Name");
		document.getElementById('artistID').focus();
		return false;
	}
	if (document.getElementById('categoryID').value == '') {
		alert("Please Select Painting Category");
		document.getElementById('categoryID').focus();
		return false;
	}
	if (document.getElementById('themeID').value == '') {
		alert("Please Select Painting Theme");
		document.getElementById('themeID').focus();
		return false;
	}
	if (document.getElementById('mediumID').value == '') {
		alert("Please Select Painting medium");
		document.getElementById('mediumID').focus();
		return false;
	}
	if (document.form1.Gname.value == '') {
		alert("Name Must Be Filled ");
		document.form1.Gname.focus();
		return false;
	}
	if (document.form1.Gimage.value == '') {
		alert("Painting Image Must Be filled ");
		document.form1.Gimage.focus();
		return false;
	}

}
function editgallery() {
	if (document.getElementById('gName').value == '') {
		alert("Please Enter Name Of Painting");
		document.getElementById('gName').focus();
		return false;
	}
	if (document.getElementById('artistID').value == '') {
		alert("Please Select Artist Name");
		document.getElementById('artistID').focus();
		return false;
	}
	if (document.getElementById('categoryID').value == '') {
		alert("Please Select Painting Category");
		document.getElementById('categoryID').focus();
		return false;
	}
	if (document.getElementById('themeID').value == '') {
		alert("Please Select Painting Theme");
		document.getElementById('themeID').focus();
		return false;
	}
	if (document.getElementById('mediumID').value == '') {
		alert("Please Select Painting medium");
		document.getElementById('mediumID').focus();
		return false;
	}
}

function findPosX(a, b) {
	var c = document.getElementById(b);
	var d = 240;
	if (a.offsetParent)
		while (1) {
			d += a.offsetLeft;
			if (!a.offsetParent)
				break;
			a = a.offsetParent
		}
	else if (a.x)
		d += a.x;
	c.style.left = d + "px";
	return true;
}
function findPosY(a, b) {
	var c = document.getElementById(b);
	var d = -66;
	if (a.offsetParent)
		while (1) {
			d += a.offsetTop;
			if (!a.offsetParent)
				break;
			a = a.offsetParent
		}
	else if (a.y)
		d += a.y;
	c.style.top = d + 36 + "px";
	return true;
}

function findPosX1(a, b) {
	var c = document.getElementById(b);
	var d = 0;
	if (a.offsetParent)
		while (1) {
			d += a.offsetLeft;
			if (!a.offsetParent)
				break;
			a = a.offsetParent
		}
	else if (a.x)
		d += a.x;
	c.style.left = d + "px";
	return true;
}
function findPosY1(a, b) {
	var c = document.getElementById(b);
	var d = 0;
	if (a.offsetParent)
		while (1) {
			d += a.offsetTop;
			if (!a.offsetParent)
				break;
			a = a.offsetParent
		}
	else if (a.y)
		d += a.y;
	c.style.top = d + 36 + "px";
	return true;
}

function userLogin1(){
	
	if(document.getElementById('User').checked == false && document.getElementById('Artist').checked == false && document.getElementById('Partner').checked == false && document.getElementById('Advertiser').checked == false )
	{
		document.getElementById('Emailg').innerHTML = '<center style="color:#ee2d19;">Please Select Any One Login As User/Artist/Partnet/Advertiser</center>';
		document.getElementById('User').focus();
		return false;
	}
	if(document.Userlogin.txtEmail.value==''){
		document.getElementById('errEmail').innerHTML = '<center style="color:#ee2d19;">Please Enter Email Id..</center>';
		document.Userlogin.txtEmail.focus();
		return false;
	}
	var em=/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
	if(!document.Userlogin.txtEmail.value.match(em) )
	  {
		document.getElementById('errEmail').innerHTML = '<center style="color:#ee2d19;">Please Enter A Valid Email Id..</center>';
	    document.Userlogin.txtEmail.focus() ;
	    return false;
	  }
	if(document.Userlogin.txtPass.value==''){
		document.getElementById('errPass').innerHTML = '<center style="color:#ee2d19;">Please Enter Your Password..</center>';
		document.Userlogin.txtPass.focus();
		return false;
	}
}

function userLogin2(){
	if(document.Userlogin.txtEmail.value!=''){
		document.getElementById('errEmail').innerHTML = '<center>&nbsp;</center>';
	}
	if(document.Userlogin.txtPass.value!=''){
		document.getElementById('errPass').innerHTML = '<center>&nbsp;</center>';
	}

}
function validate(){

	if(document.signup.Fname.value==''){
		alert("Please Enter Your First Name");
		document.signup.Fname.focus();
		return false;
	}
	if(document.signup.Lname.value==''){
		alert("Please Enter Your Last Name");
		document.signup.Lname.focus();
		return false;
	}
	if(document.signup.Email.value==''){
		alert("Please provide your E-mail!");
		document.signup.Email.focus();
		return false;
	}
	var em=/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
	if(!document.signup.Email.value.match(em) )
	  {
	    alert( "Please Enter Your Valid E-Mail!" );
	    document.signup.Email.focus() ;
	    return false;
	  }
	if(document.signup.Password.value==''){
		alert("Please Enter Your Password");
		document.signup.Password.focus();
		return false;
	}
	if(document.signup.CPassword.value==''){
		alert("Please Confirm your New password ");
		document.signup.CPassword.focus();
		return false;
	}
	if((document.signup.CPassword.value!='')&&(document.signup.CPassword.value !=document.signup.Password.value)){
		alert("Password not Matched With New Password");
		document.signup.CPassword.focus();
		return false;
	}
	if(document.signup.sex[0].checked == false && document.signup.sex[1].checked == false )
	{
		alert("Please Select your Gender ");
		document.signup.sex[0].focus();
		return false;
	}
	if(document.signup.EnterCodeHere.value=='' )
	{
		alert("Please Enter Verification Code ");
		document.signup.EnterCodeHere.focus();
		return false;
	}
	var val1 = document.signup.capValue.value;
	var val2 = document.signup.EnterCodeHere.value;
	if(val1!=val2){
		alert("Verification code must  be same");
		document.signup.EnterCodeHere.value="";
		reloadCaptcha()
		document.signup.EnterCodeHere.focus();
		return false;
	}
	}
function userLogin(){
if(document.Userlogin.txtEmail.value==''){
	alert("Please provide your E-mail!");
	document.Userlogin.txtEmail.focus();
	return false;
}
var em=/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
if(!document.Userlogin.txtEmail.value.match(em) )
  {
    alert( "Please Enter Your Valid E-Mail!" );
    document.Userlogin.txtEmail.focus() ;
    return false;
  }
if(document.Userlogin.txtPass.value==''){
	alert("Please Enter Your Password");
	document.Userlogin.txtPass.focus();
	return false;
}
}
function forgotPassword(){
	if(document.forgetPassword.forgrtPassword.value==''){
		document.getElementById('error').innerHTML = '<center style="color:#ee2d19;">Please Enter Email Id..</center>';
		document.forgetPassword.forgrtPassword.focus();
		return false;
	}
	if(document.forgetPassword.cPassword.value==''){
		document.getElementById('errorPass').innerHTML = '<center style="color:#ee2d19;">Please Enter Your Password ..</center>';
		document.forgetPassword.cPassword.focus();
		return false;
	}
	if((document.forgetPassword.cPassword.value!='')&&(document.forgetPassword.cPassword.value !=document.forgetPassword.forgrtPassword.value)){
		document.getElementById('errorPass').innerHTML = '<center style="color:#ee2d19;">Password not Matched With  Confirm Password.</center>';
		document.forgetPassword.cPassword.focus();
		return false;
	}
	}
function forgetPassword1(){
	if(document.forgetPassword.forgrtPassword.value!=''){
		document.getElementById('error').innerHTML = '<center>&nbsp;</center>';
	}
	if(document.forgetPassword.cPassword.value!=''){
		document.getElementById('errorPass').innerHTML = '<center>&nbsp;</center>';
	}

}
function forgotPasswordUser(){
	if(document.forgetPass.forgrtmail.value==''){
		document.getElementById('errorPass').innerHTML = '<span style="color:#ee2d19;">Please Enter Your Email Id For Find Password.</span>';
		document.forgetPass.forgrtmail.focus();

		return false;
	}
}
function forgetPassword1(){
	if(document.forgetPass.forgrtPassword.value!=''){
		document.getElementById('error').innerHTML = '<center>&nbsp;</center>';
	}
	
}
function findPosX2(a, b) {
	var c = document.getElementById(b);
	var d = -282;
	if (a.offsetParent)
		while (1) {
			d += a.offsetLeft;
			if (!a.offsetParent)
				break;
			a = a.offsetParent
		}
	else if (a.x)
		d += a.x;
	c.style.left = d + "px";
	return true;
}
function findPosY2(a, b) {
	var c = document.getElementById(b);
	var d = 27;
	if (a.offsetParent)
		while (1) {
			d += a.offsetTop;
			if (!a.offsetParent)
				break;
			a = a.offsetParent
		}
	else if (a.y)
		d += a.y;
	c.style.top = d + "px";
	return true;
}

function checkIt(el)
{
    if (el.value == "aReseller"  ) {
        document.getElementById('text' ).style.display = "none";
        document.getElementById('text2').style.display = "block";
     }
    else {
        document.getElementById('text2').style.display = "none";
        
        document.getElementById('who').value = '';
    }
}
function checkIt1(el)
{
    if (el.value == "aArtist"  ) {
        document.getElementById('text').style.display = "block";
        document.getElementById('text2').style.display = "none";
    }
    else {
        document.getElementById('text2').style.display = "none";
        
        document.getElementById('who').value = '';
    }
}
function checkIt2(el)
{
    if (el.value == "aUser"  ) {
        document.getElementById('text').style.display = "block";
        document.getElementById('text2').style.display = "none";
    }
    else {
        document.getElementById('text2').style.display = "none";
        
        document.getElementById('who').value = '';
    }
}
function checkIt2(el)
{
    if (el.value == "aUser"  ) {
        document.getElementById('text').style.display = "block";
        document.getElementById('text2').style.display = "none";
    }
    else {
        document.getElementById('text2').style.display = "none";
        
        document.getElementById('who').value = '';
    }
}
function checkIt3(el)
{
	if (el.value == "aAdvertiser"  ) {
        document.getElementById('text').style.display = "none";
        document.getElementById('text2').style.display = "block";
    }
    else {
        document.getElementById('text2').style.display = "none";
        
        document.getElementById('who').value = '';
    }
}

function reloadCaptcha() {
	var url = "/reloadCaptcha";
	ajax_loadContent("capDiv", url);
}

function signupSubmit()
{
	if (document.getElementById('select').value == 'aUser') {
	
	document.forms.signup.action = '/newUserRegistration';
	document.forms.signup.submit;
	}
	else if(document.getElementById('select').value == 'aArtist')
	{
		document.forms.signup.action = '/insertArtist';
		document.forms.signup.submit;
		
		
	}
}
function signupSubmit1()
{
	document.forms.signup.action = '/advertiserContinue';
	document.forms.signup.submit;
}
function userlogindff() {
	if(document.getElementById('User').checked == false && document.getElementById('Artist').checked == false && document.getElementById('Partner').checked == false && document.getElementById('Advertiser').checked == false )
	{
		document.getElementById('Emailg').innerHTML = '<center style="color:#ee2d19; margin-bottom:5px;">Please Select Any One Of The Login Type.</center>';
		document.getElementById('User').focus();
		return false;
	}
	
	if (document.getElementById('emil').value == '') {
		document.getElementById('Emailfgfg').innerHTML = '<center style="color:#ee2d19;">Please Enter Email Id..</center>';
		document.getElementById('emil').focus();
		return false;
	}
	var em=/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
	if(!document.getElementById('emil').value.match(em) )
	  {
		document.getElementById('Emailfgfg').innerHTML = '<center style="color:#ee2d19;">Please Enter A Valid Email Id..</center>';
	    document.getElementById('emil').focus() ;
	    return false;
	  }
	if (document.getElementById('pass').value == '') {
		document.getElementById('errPassfdf').innerHTML = '<center style="color:#ee2d19;">Please Enter Your Password..</center>';
		document.getElementById('pass').focus();
		return false;
	}
	}
	
	function userLoginbyheader(){
		
		if(document.getElementById('User1').checked == false && document.getElementById('Artist1').checked == false && document.getElementById('Partner1').checked == false && document.getElementById('User1').checked == false &&document.getElementById('Advertise1').checked == false)
		{
			
			
			document.getElementById('userid').innerHTML = '<center style="color:#ee2d19;">Please Select Any One of the Login Type</center>';
			return false;
		}
		if(document.getElementById('loginuser').value==''){
			document.getElementById('ermail').innerHTML = '<center style="color:#ee2d19;">Please Enter Emalil id</center>';
			document.getElementById('loginuser').focus();
			return false;
		}
	
		var em=/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
		if(!document.getElementById('loginuser').value.match(em) )
		  {
			document.getElementById('ermail').innerHTML = '<center style="color:#ee2d19;">Please Enter Valid  Emalil id</center>';
			document.getElementById('loginuser').focus();
		    return false;
		  }
		if(document.getElementById('loginpass').value==''){
			document.getElementById('erPass').innerHTML = '<center style="color:#ee2d19; margin-top:px;">Please Enter  your password</center>';
			document.getElementById('loginpass').focus();
			return false;
		}
	}
	function userjoinheader(){
		if (document.getElementById('ermail').value!='') {
			document.getElementById('ermail').innerHTML = '<center>&nbsp;</center>';
		}
		if (document.getElementById('loginpass').value!='') {
			document.getElementById('erPass').innerHTML = '<center>&nbsp;</center>';
		}
		if (document.getElementById('User1').checked!=false) {
			document.getElementById('userid').innerHTML = '<center>&nbsp;</center>';
		}
		if (document.getElementById('Artist1').checked!=false) {
			document.getElementById('userid').innerHTML = '<center>&nbsp;</center>';
		}
		if (document.getElementById('Partner1').checked!=false) {
			document.getElementById('userid').innerHTML = '<center>&nbsp;</center>';
		}
		if (document.getElementById('Advertise1').checked!=false) {
			document.getElementById('userid').innerHTML = '<center>&nbsp;</center>';
		}
		
}
	function chooseState() {
		var str = document.getElementById('CountryID').value;
		var url = "/loadstate/" + str;
		ajax_loadContent("LoadState", url);
	}
	function chooseCity() {
		var str = document.getElementById('stateID').value;
		var url = "/loadCity/" + str;
		ajax_loadContent("LoadCity", url);
	}
	function artistRegister(){
		if(document.advertiseContinue.Address.value==''){
		document.getElementById('erroradress').innerHTML = '<center style="color:#ee2d19; margin-left:-200px;">Please Enter Your Address</center>'
		document.advertiseContinue.Address.focus();
		return false;
		}
		if(document.advertiseContinue.CountryID.value==''){
			document.getElementById('erroradress1').innerHTML = '<center style="color:#ee2d19; margin-left:-200px;">Please Select Your Country</center>'
			document.advertiseContinue.CountryID.focus();
			return false;
			}
		if(document.advertiseContinue.stateID.value==''){
			document.getElementById('erroradress2').innerHTML = '<center style="color:#ee2d19; margin-left:-200px;">Please Select Your State</center>'
			document.advertiseContinue.stateID.focus();
			return false;
			}
		if(document.advertiseContinue.cityID.value==''){
			document.getElementById('erroradress3').innerHTML = '<center style="color:#ee2d19; margin-left:-200px;">Please Select Your city</center>'
			document.advertiseContinue.cityID.focus();
			return false;
			}
		if(document.advertiseContinue.Mobile.value==''){
			document.getElementById('erroradress4').innerHTML = '<center style="color:#ee2d19; margin-left:-200px;">Please Enter Your Contact Number</center>'
			document.advertiseContinue.Mobile.focus();
			return false;
			}
		
		
	}
	function artistregisterremove(){
		if (document.getElementById('Address').value!='') {
			document.getElementById('erroradress').innerHTML = '<center>&nbsp;</center>';
		}
		if (document.getElementById('CountryID').value!='') {
			document.getElementById('erroradress1').innerHTML = '<center>&nbsp;</center>';
		}
		if (document.getElementById('stateID').value!='') {
			document.getElementById('erroradress2').innerHTML = '<center>&nbsp;</center>';
		}
		if (document.getElementById('cityID').value!='') {
			document.getElementById('erroradress3').innerHTML = '<center>&nbsp;</center>';
		}
		if (document.getElementById('Mobile').value!='') {
			document.getElementById('erroradress4').innerHTML = '<center>&nbsp;</center>';
		}
		
		
}

	
	